package org.kgc.alanhealth.controller;

import org.kgc.alanhealth.entity.HospitalDepartment;
import org.kgc.alanhealth.entity.HospitalSymptomatic;
import org.kgc.alanhealth.service.HospitalDepartmentService;
import org.kgc.alanhealth.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

@RestController
@CrossOrigin(origins = "*")

public class HospitalDepartmentController {



    private final HospitalDepartmentService hospitalDepartmentService;

    @Autowired
    public HospitalDepartmentController(HospitalDepartmentService hospitalDepartmentService) {
        this.hospitalDepartmentService = hospitalDepartmentService;
    }

    @RequestMapping("api/hospital-departments")
    public Result getAllSymptomatic(){
        List<HospitalDepartment> list =hospitalDepartmentService.findAll();
        if (list!=null&&!list.isEmpty()){
            return Result.success(list);
        }else {
            return Result.error("没有找到数据");
        }
    }
}